package com.seven.springboot.config;

import org.apache.catalina.filters.RemoteIpFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.seven.springboot.filter.SevenSpringBootFilter;

@Configuration
public class WebConfig {

	@Bean
	public RemoteIpFilter remoteIpFilter(){
		return new RemoteIpFilter();
	}
	
	@Bean
	public FilterRegistrationBean filterRegistrationBean(){
		FilterRegistrationBean filterRegistration = new FilterRegistrationBean();
		filterRegistration.setFilter(new SevenSpringBootFilter());
		filterRegistration.addUrlPatterns("/*");
		filterRegistration.addInitParameter("paramName", "paramValue");
		filterRegistration.setName("SevenSpringBootFilter");
		filterRegistration.setOrder(1);
		return filterRegistration;
	}
	
}
